package org.example.spring_frist.LibraryProject.dao;

import org.example.spring_frist.LibraryProject.model.bookInfo;
import org.example.spring_frist.LibraryProject.mapper.bookInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class booksDao {

    @Autowired
    bookInfoMapper bookInfoMapper;

    public List<bookInfo> getBookList() {
        return bookInfoMapper.getBookInfoAll();
    }

    public bookInfo getBookById(int id) {
        return bookInfoMapper.getBookInfoById(id);
    }

    public int addBook(bookInfo bookInfo) {
        return bookInfoMapper.addBookInfo(bookInfo);
    }

    public int adjust(bookInfo bookInfo) {
        return bookInfoMapper.updateBookInfo(bookInfo);
    }

    public int del(Integer bookId) {
        return bookInfoMapper.deleteBookInfoById(bookId);
    }

}
